package com.graduation.system.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * 功能：客户实体类 
 * 对应数据库表：SYS_CUSTOMER 
 * 作者：吴泽磊 
 * 时间：2016/10/14
 */

@Entity
@Table(name = "SYS_CUSTOMER")
@DynamicInsert(true)
@DynamicUpdate(true)
public class SysCustomer {

	private Integer custId; // 客户id，唯一，自增长，主键
	private String userName; // 用户名称，不唯一
	private String passWord; //登入密码
	private SysDepartment sysDepartment;//注册学校ID department部门表的ID
	private String phone;//管理员联系手机号码
	private Byte status;//状态：0为正常，1为移除（不是删除）
	

//	private Integer managerId; //管理员ID
//	private Integer schoolid; //管理员所在学校ID
//	private SysSchool sysSchool;
//	private String managerName; //管理员姓名
//	private String managerPhone; //管理员联系电话
//	private String address; //管理员所在地址
//	private String account; //管理员所持有账号
//	private String password; //管理员所持有账号密码
//	private String photo; //管理员照片
//	private java.sql.Timestamp regTime; //管理员账号注册时间
//	private byte status; //状态 
	
	@Id
	@Column(name = "CUST_ID", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO) // 自增长
	public Integer getCustId() {
		return custId;
	}
	public void setCustId(Integer custId) {
		this.custId = custId;
	}
	@NotEmpty
	@Column(name = "USER_NAME", nullable = false)
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	@NotEmpty
	@Column(name = "PASSWORD",nullable = false)
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	@ManyToOne(targetEntity = SysDepartment.class)
	@JoinColumn(name = "DEP_ID")
	public SysDepartment getSysDepartment() {
		return sysDepartment;
	}
	public void setSysDepartment(SysDepartment sysDepartment) {
		this.sysDepartment = sysDepartment;
	}
	@Column(name = "PHONE", nullable = false)
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	@Column(name = "STATUS", nullable = false, columnDefinition = "tinyint default 0")
	public Byte getStatus() {
		return status;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}

}
